#include "proxy/channel/client_side.h"
#include "proxy/channel/client_conn_pair.h"

namespace proxy{

  ClientSide::ClientSide(std::string bind_addr, uint16 bind_port,
    std::string proxy_addr, uint16 porxy_port, int thread_num)
    :TcpServer(bind_addr, bind_port, thread_num),
    porxy_port_(porxy_port),
    proxy_addr_(proxy_addr){

  }

  ClientSide::~ClientSide(){
    DLOG(WARNING) << "Delete";
  }

  void ClientSide::OnNewConnect(TcpAccpetServer::Ptr accpet_server,
    socket_ptr connect){
    DLOG(INFO) << "New Connect arrive";
    ClientConnPair::Ptr client_conn_pair(new ClientConnPair(connect, flow_instance()));
    //client_conn_pair->Start("106.186.24.122", 80);
    client_conn_pair->Start(proxy_addr_, porxy_port_);
  }
}